
package com.scs.application.modules.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.scs.application.core.service.BaseServiceImpl;
import com.scs.application.modules.base.entity.CertificateSummary;
import com.scs.application.modules.base.mapper.CertificateSummaryMapper;
import com.scs.application.modules.base.request.CertificateSummaryQueryRequest;
import com.scs.application.modules.base.service.CertificateSummaryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资质汇总 service 实现
 */
@Slf4j
@Service
public class CertificateSummaryServiceImpl extends BaseServiceImpl<CertificateSummaryMapper, CertificateSummary> implements CertificateSummaryService {

    @Override
    public List<CertificateSummary> list(CertificateSummaryQueryRequest request) {
        List<CertificateSummary> list = this.list(getQueryWrapper(request));
        return list;
    }

    @Override
    public IPage<CertificateSummary> page(CertificateSummaryQueryRequest request) {
        IPage page = this.page(request.getPage(), getQueryWrapper(request));
        return page;
    }

    private QueryWrapper<CertificateSummary> getQueryWrapper(CertificateSummaryQueryRequest request) {
        return Wrappers.<CertificateSummary>query()
                .orderByDesc("gmt_modified");
    }
}
